Getting Started: Running the “USB Generic device” Demo

 

Required Hardware: 1

Configuration: Explorer 16. 1

Configuring the Hardware: 2

Configuration: Explorer 16. 4

Firmware. 7

Running the Demo. 8

Installing the driver 8

Running the demo. 10

Trademarks: 14

 

 

Required Hardware:

  To run this project, you will need one of the following sets of hardware:

 

    Configuration: Explorer 16

Explorer 16 (DM240001)

            USB PICtail™ Plus Daughter Card (AC164131)

PIC32MX USB Plug-In-Module (PIM) (MA320002)

 

Configuring the Hardware:

 

This section describes how to set up the various configurations of hardware to run this demo.

Configuration: PIC24FJ256GB110 PIM + Explorer 16

 

Configuration: Explorer 16

1) Before attaching the PIM to the Explorer 16 board, insure that the processor selector switch (S2) is in the “PIM” position as seen in the image below.

 

2) Short the J7 jumper to the “PIC24” setting

 

3) Before connecting the PIM to the Explorer 16 board, remove all attached cables from both boards.  Connect the PIM to the Explorer 16 board.  Be careful when connecting the boards to insure that no pins are bent or damaged during the process.  Also insure that the PIM is not shifted in any direction and that all of the headers are properly aligned.

 

4)  On the USB PICTail Plus board, short jumper JP1.  Remove all other shorts on the board.

 

5)  Connect the USB PICTail Plus board to either of the female PICTail Plus connectors or on the card edge connector (J9) at the edge of the Explorer 16 board.

 

 

Firmware:

To run this project, you will need to load the corresponding firmware into the devices.  There are two methods available for loading the demos: Precompiled demos and source code projects.

 

Precompiled Demos are available in the “<Install Directory>\USB – Precompiled Demos” folders.  Each demo should be prefaced with the hardware platform it is compiled for.  Select the file that matches the hardware that you have and the demo that you want to run.  For more information about how to load a precompiled project, please see the “Getting Started – Loading a precompiled demo” guide.

 

The source code for this demo is available in the “<Install Directory>\usb_generic_device_demo” directory.  In this directory you will find all of the user level source and header files as well as project and workspace files.  Find the project (*.mcp) or workspace (*.mcw) file.  Compile and program the demo code into the hardware platform.  For more help on how to compile and program projects, please refer to the MPLAB® help available through the help menu of MPLAB (Help->Topics…->MPLAB IDE).

 

The source code for the driver and some example PC applications can be found at “<Install Directory>\Microchip\USB\Utilities\MCHPUSB Custom Driver\Mpusbapi”

 

 

Running the Demo:

 

          Installing the driver

The generic driver (custom class) demo uses a custom class driver.  Like any custom driver when first plugged into a computer, a driver needs to be installed.  When the device is plugged in to the computer the following window will pop-up:

 

Continue by selecting either options and clicking next.

 

If the driver has been installed on the computer before the installation process may complete itself without further action.

 

If the driver has not been installed before on the computer, then the driver will need to be installed.  The Found New Hardware Wizard will be looking for a *.inf file with a matching VID/PID as the newly attached USB device.  The driver can be found in the following location: “<Install Directory>\USB Tools\MCHPUSB Custom Driver\MCHPUSB Driver\Release”.  Point the install wizard to this directory.  The install wizard should then continue and finally complete.

 

Some example PC applications which interface with the driver can be found at “<Install Directory>\USB Tools\MCHPUSB Custom Driver\Mpusbapi”.  PC applications can be written to either directly interface with the custom class USB driver (by using standard I/O functions like CreateFile(), ReadFile(), WriteFile(), CloseHandle()), or indirectly through the use of mpusbapi.dll.  Mpusbapi.dll is a dynamic linked library file, which makes the process of interfacing with the custom class USB driver (and therefore, your USB device) somewhat simpler. 

 

Running the demo

Once the driver is installed the device can start to be used.  Because this is not a standard driver class that is supported by default in any of the operating systems, a custom application is also required to talk to this device.  The pdfsusb example application is provided in this distribution.

 

PDFSUSB

 

The example application can be found in the “<Install Directory>\USB Device - MCHPUSB - Generic Driver Demo\PC Software\Pdfsusb” directory.

 

When the application is first launched it will look like the following.

 

Select the “Demo Mode” tab.

 

In the listbox at the top of the application, select the “PICDEM FS USB…” option.  If this option is not available then the device is either not connected to the computer, the driver was not installed correctly, or the firmware programmed into the device was not the correct project needed to interface with the generic driver.

 

With the listbox selecting the “PICDEM FS USB…” click the connect button.  Once the button is clicked the application should start reading the potentiometer and temperature data from the hardware.  The application can also change the state of the LEDs.  NOTE: the Low Pin Count USB Development Kit does not have an on board temperature sensor.  This feature is not currently implemented.

 

 

Trademarks:

The Microchip name and logo, the Microchip logo, MPLAB, and PIC are registered trademarks of Microchip Technology Incorporated in the U.S.A. and other countries.

PICDEM and PICTail are trademarks of Microchip Technology Incorporated in the U.S.A. and other countries.

Microsoft, Windows, and Windows Vista are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries.

SD is a trademark of the SD Association in the U.S.A and other countries